#include<iostream>
using namespace std;

class Date
{
public:
	Date(int year = 1, int month = 1, int day = 1)
	{
		cout << "Date(int year = 1, int month = 1, int day = 1)" << endl;
		_year = year;
		_month = month;
		_day = day;
	}
	Date(const Date& d)
	{
		cout << "Date(const Date& d)" << endl;
		_year = d._year;
		_month = d._month;
		_day = d._day;
	}
	void Print() const
	{
		cout << _year << "/" << _month << "/" << _day << endl;
	}
	bool operator==(const Date& d) const
	{
		return _year == d._year
			&& _month == d._month
			&& _day == d._day;
	}
	//ֵ赋值运算符重载
	Date& operator=(const Date& d) 
	{
		cout << "Date& operator=(const Date& d)" << endl;
		if (this != &d)
		{
			_year = d._year;
			_month = d._month;
			_day = d._day;
		}
		return *this;
	}
	bool operator<(const Date& d) const
	{
		if (_year < d._year)
		{
			return true;
		}
		else if (_year == d._year)
		{
			if (_month < d._month)
			{
				return true;
			}
			else if (_month == d._month)
			{
				return _day < d._day;
			}
		}
		return false;
	}
	bool operator<=(const Date& d) const
	{
		return *this < d || *this == d;
	}
	bool operator>(const Date& d) const
	{
		return !(*this <= d);
	}
	bool operator>=(const Date& d) const
	{
		return !(*this < d);
	}
private:
	int _year;
	int _month;
	int _day;
};

int main()
{
	Date d1(2025, 9, 19);
	//拷贝构造
	Date d2 = d1;
	d2.Print();

	Date d3(2025, 9, 20);
	Date d4(2025, 9, 21);
	//ֵ赋值重载
	d4 = d3;
	d4.Print();

	Date d5(2025, 9, 22);
	Date d6(2025, 8, 22);
	if (d5 < d6)
	{
		cout << "d5<d6" << endl;
	}
	else
	{
		cout << "d5>d6" << endl;
	}
	return 0;
}